﻿@model SchoolCommunicationSystem.Models.UserProfilesViewModel

@{
    ViewBag.Title = "Thay đổi thông tin";
    SCS.Business.MembershipService _membershipServices = new SCS.Business.MembershipService();
    string userName = User.Identity.Name;
    var user = _membershipServices.GetUser(userName);
    if (user.MembershipRoles.FirstOrDefault().roleID == 2)
    {
        Layout = "~/Views/Shared/_ParentsLayout.cshtml";
    }
    else if (user.MembershipRoles.FirstOrDefault().roleID == 3 || user.MembershipRoles.FirstOrDefault().roleID == 4)
    {
        Layout = "~/Views/Shared/_TeacherLayout.cshtml";
    }
    else
    {
        Layout = "~/Views/Shared/_AdminLayout.cshtml";
    }
}

<div id="page-heading">
    <h1>Thay đổi thông tin cá nhân</h1>
</div>
<div class="container">
    <div class="row">
        <div class="col-sm-12">
            <div class="panel panel-primary">
                <div class="panel-heading">
                    <h4>Thông tin cá nhân</h4>
                </div>
                <div class="panel-body">
                    @using (Html.BeginForm("ChangeInformation", "Members", FormMethod.Post, new { @class = "form-horizontal" }))
                    {
                        <div class="form-group">
                            @Html.Label("Tên đăng nhập:", new { @class = "col-sm-2 control-label" })
                            <div class="col-sm-6">
                                @Html.TextBoxFor(model => model.MembershipUser.userName, new { @readonly = "readonly" })
                            </div>
                        </div>
                        <div class="form-group">
                            @Html.Label("Email:", new { @class = "col-sm-2 control-label" })
                            <div class="col-sm-6">
                                @Html.TextBoxFor(model => model.MembershipUser.email)
                            </div>
                        </div>
                        if (Model.Parents != null)
                        {
                        <text>
                        <div class="form-group">
                            @Html.Label("Họ tên:", new { @class = "col-sm-2 control-label" })
                            <div class="col-sm-6">
                                @Html.TextBoxFor(model => model.Parents.parentName,new { @readonly = "readonly" })
                            </div>
                        </div>
                        <div class="form-group">
                            @Html.Label("Số điện thoại:", new { @class = "col-sm-2 control-label" })
                            <div class="col-sm-6">
                                @Html.TextBoxFor(model => model.Parents.mobile)
                            </div>
                        </div>
                        <div class="form-group">
                            @Html.Label("Số điện thoại nhà riêng:", new { @class = "col-sm-2 control-label" })
                            <div class="col-sm-6">
                                @Html.TextBoxFor(model => model.Parents.tel)
                            </div>
                        </div>
                        @if (Model.Parents.Learners.Any())
                        {
                            <text>
                            <div class="form-group">
                            @Html.Label("Địa chỉ:", new { @class = "col-sm-2 control-label" })
                            <div class="col-sm-6">
                                @Html.TextBoxFor(model => model.Parents.Learners.FirstOrDefault().address)
                            </div>
                        </div>
    </text>
                        }
                        </text>
                        }
                        if (Model.Teacher != null)
                        {
                        <div class="form-group">
                            @Html.Label("Họ tên:", new { @class = "col-sm-2 control-label" })
                            <div class="col-sm-6">
                                @Html.TextBoxFor(model => model.Teacher.teacherName,new { @readonly = "readonly" })
                            </div>
                        </div>
                        <div class="form-group">
                            @Html.Label("Số điện thoại:", new { @class = "col-sm-2 control-label" })
                            <div class="col-sm-6">
                                @Html.TextBoxFor(model => model.Teacher.mobile)
                            </div>
                        </div>
                        <div class="form-group">
                            @Html.Label("Địa chỉ:", new { @class = "col-sm-2 control-label" })
                            <div class="col-sm-6">
                                @Html.TextBoxFor(model => model.Teacher.address)
                            </div>
                        </div>
                        }
                        <div class="row">
                            <div class="col-sm-6 col-sm-offset-2">
                                <div class="btn-toolbar">
                                    <button class="btn-primary btn" type="submit">Thay đổi</button>
                                </div>
                            </div>
                        </div>
                    }
                </div>
            </div>
        </div>
    </div>
</div>
